/**
 * Company : Thai Informatic System Co., Ltd.
 * Created By : Dr.Tree
 * Created On : Apr 4, 2012  11:11:29 AM 
 * e-Mail : chatree@tis.co.th
 * Mobile Phone : (+66) 087-921-5115
 * Package Name : jpa.entitys.promis.construction
 * File Name : VwSyncRequestPaymentServices.java
 * TODO
 */
package jpa.service.promis.construction;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import org.apache.log4j.Logger;
import jpa.entitys.promis.construction.VwSyncRequestPayment;
import jpa.service.common.JPAService;

/**
 * @author chatree
 *
 */
public class VwSyncRequestPaymentServices extends JPAService {
	
	private static final Logger log = Logger.getLogger(VwSyncRequestPaymentServices.class);

	/**
	 * @param em
	 */
	public VwSyncRequestPaymentServices(EntityManager em) {
		super(em);
	}
	
	
	public VwSyncRequestPayment findById(String id) throws Exception {		
		
		return super.ConvertToYoureObject(super.find(id, "VwSyncRequestPayment.findById"));
	}
	
	public List<VwSyncRequestPayment> findAll() throws Exception {
		return super.ConvertToYoureObject(super.findAll("VwSyncRequestPayment.findAll"));
	}
	
	public List<VwSyncRequestPayment> findByDocumentNo(String company, String project ,String documentNo, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);		
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("status", status);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocumentNo", mapWhereValue));
	}
	
	
	public List<VwSyncRequestPayment> findByDocumentWithoutVO1(String company, String project ,String documentNo, String refType, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("status", status);
		mapWhereValue.put("refType", refType);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocumentWithoutVO", mapWhereValue));
	}	
	
	/**
	 * 
	 * @param company
	 * @param project
	 * @param documentNo
	 * @param status
	 * @param syncIsstaging
	 * @return
	 * @throws Exception
	 * Add 2031-03-26 
	 * Palith Change to old Concept 
	 */
	public List<VwSyncRequestPayment> findByDocumentWithVO(String company, String project ,String documentNo, String status, String syncIsstaging) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("status", status);
		mapWhereValue.put("syncIsstaging", syncIsstaging);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocumentWithVO", mapWhereValue));
	}
	
	public List<VwSyncRequestPayment> findByDocUnit(String company, String project, String buildingPhase, String zoneCode, String unitNumber ,String documentNo, BigDecimal refContUnitSeq, String status) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("buildingPhase", buildingPhase);
		mapWhereValue.put("zoneCode", zoneCode);
		mapWhereValue.put("unitNumber", unitNumber);
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("refContractSeq", refContUnitSeq);
		mapWhereValue.put("status", status);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocUnit", mapWhereValue));
	}
	

	public List<VwSyncRequestPayment> findByDocUnit0(String company, String project, String buildingPhase, String zoneCode, String unitNumber ,String documentNo, BigDecimal refContUnitSeq, String status, String lineInstKey) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("buildingPhase", buildingPhase);
		mapWhereValue.put("zoneCode", zoneCode);		
		mapWhereValue.put("unitNumber", unitNumber);
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("refContractSeq", refContUnitSeq);
		mapWhereValue.put("lineInstKey", lineInstKey);
		mapWhereValue.put("status", status);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocUnit0", mapWhereValue));
	}
	
	
	public List<VwSyncRequestPayment> findByDocUnit1(String company, String project, String buildingPhase, String zoneCode, String unitNumber ,String documentNo, BigDecimal refContUnitSeq, String lineInstKey) throws Exception {
		Map<String,Object> mapWhereValue = new HashMap<String, Object>();				
		mapWhereValue.put("company", company);
		mapWhereValue.put("project", project);
		mapWhereValue.put("buildingPhase", buildingPhase);
		mapWhereValue.put("zoneCode", zoneCode);
		mapWhereValue.put("unitNumber", unitNumber);		
		mapWhereValue.put("documentNo", documentNo);
		mapWhereValue.put("refContractSeq", refContUnitSeq);
		mapWhereValue.put("lineInstKey", lineInstKey);
		
		return super.ConvertToYoureObject(super.find("VwSyncRequestPayment.findByDocUnit1", mapWhereValue));
	}
}
